//
//  UIFont+JJExtension.swift
//  JJToolSwift
//
//  Created by heihei on 2024/5/8.
//

import Foundation

/// 自定义字体类型
public enum CustomerFont: String {
    /// PingFangSC-Medium字体，苹方-简 中黑体
    case pingFangSCMedium = "PingFangSC-Medium"
    /// PingFangSC-Regular字体，苹方-简 常规体
    case pingFangSCRegular = "PingFangSC-Regular"
    /// PingFangSC-Ultralight字体，苹方-简 极细体
    case pingFangSCUltralight = "PingFangSC-Ultralight"
    /// PingFangSC-Light字体，苹方-简 细体
    case pingFangSCLight = "PingFangSC-Light"
    /// PingFangSC-Thin字体，苹方-简 纤细体
    case pingFangSCThin = "PingFangSC-Thin"
    /// PingFangSC-Semibold字体，苹方-简 中粗体
    case pingFangSCSemibold = "PingFangSC-Semibold"
    /// HelveticaNeue字体，HelveticaNeue 常规体
    case helveticaNeue = "HelveticaNeue"
    /// HelveticaNeue-Medium字体，HelveticaNeue 中黑体
    case helveticaNeueMedium = "HelveticaNeue-Medium"
    /// DIN-Medium字体，DIN 中黑体
    case dinMedium = "DIN-Medium"
}

public extension UIFont {
    
    /// 自定义字体
    /// - Parameters:
    ///   - name: 字体类型
    ///   - size: 字号
    /// - Returns: 返回UIFont
    static func customerFont(name: CustomerFont, size: CGFloat = 14) -> UIFont {
        return UIFont.init(name: name.rawValue, size: size) ?? UIFont.systemFont(ofSize: size)
    }
}
